package tools;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class Input implements KeyListener 
{
	public enum action{LEFT, RIGHT, UP, DOWN, NONE}
	private static action lastAction = action.NONE;	//TODO: make smoother by making a list of waiting moves
	
	public Input()
	{
		
	}
	
	@Override
	public void keyPressed(KeyEvent key) 
	{
		switch(key.getKeyChar()) {
			case 'a':
			lastAction = action.LEFT;
			break;
			
			case 'd':
			lastAction = action.RIGHT;
			break;
			
			case 'w':
			lastAction = action.UP;
			break;
			
			case 's':
			lastAction = action.DOWN;
			break;
		}
	}

	@Override
	public void keyReleased(KeyEvent key) 
	{
		lastAction = action.NONE;
	}

	@Override
	public void keyTyped(KeyEvent key) 
	{
		// TODO Auto-generated method stub
		
	}
	
	public static action getLastAction()
	{
		return lastAction;
	}

}
